home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGIALS
/
PTUTOR2B.LZH
/
SHAPES4.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-15
|
2KB
|
53 lines
(* Chapter 13 - Program 4 *)
program Calculate_Area_Of_Shapes;
uses Areas,Crt,Turbo3;
var In_Char : char;
Length,Width,Height,Base,Radius : real;
begin (* main program *)
repeat
Writeln;
Writeln('Please input the first letter of the selection');
Writeln('Select shape; Square Rectangle Triangle Circle Quit');
Write('Requested shape is ');
Repeat until Keypressed;
Read(Kbd,In_Char);
case UpCase(In_Char) of
'S' : begin
Write('Square Enter length of side ');
Readln(Length);
Writeln('The area is ',Area_Of_Square(Length):12:4);
end;
'R' : begin
Write('Rectangle Enter width ');
Readln(Width);
Write('Enter height ');
Read(Height);
Writeln(' The area is ',
Area_Of_Rectangle(Width,Height):12:4);
end;
'T' : begin
Write('Triangle Enter base ');
Readln(Base);
Write('Enter height ');
Read(Height);
Writeln(' The area is ',
Area_Of_Triangle(Base,Height):12:3);
end;
'C' : begin
Write('Circle Enter radius ');
Readln(Radius);
Writeln('The area is ',Area_Of_Circle(Radius):12:3);
end;
'Q' : Writeln('Quit');
else Writeln(' undefined entry');
end;
until (In_Char = 'Q') or (In_Char = 'q');
end. (* of main program *)